package com.example.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.entity.User;
import com.example.entity.UserAction;
import com.example.mapper.UserActionMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author admin
 * @since 2021-05-31
 */
@Service
public class UserActionService extends ServiceImpl<UserActionMapper, UserAction> implements IService<UserAction> {
    @Resource
    private  UserActionMapper  userActionMapper;


    public  UserAction getbyUsername(String username) {
        UserAction one = getOne((Wrappers.<UserAction>lambdaQuery().eq(UserAction::getUsername, username)));
        return one;
    }


    public void update1(String action,String filename) {
        if(action.equals("下载"))   userActionMapper.update1(filename);
        else  userActionMapper.update2(filename);
    }
}
